package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class RetuenOperation implements Ioperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("归还图书....");
        System.out.println("请输入要归还的书名......");
        Scanner sc=new Scanner(System.in);
        String bookname=sc.nextLine();
        int currentsize=bookList.getUseSize();
        for(int i=0;i<currentsize;i++){
            Book book=bookList.getbook(i);
            if(book.getName().equals(bookname)){
                book.setIslend(false);
                System.out.println("归还成功");
            }
        }
    }
}
